import swaggerJsDoc from 'swagger-jsdoc';
import * as path from "path";

const swaggerOptions = {
  swaggerDefinition: {
    openapi: '3.0.0',
    info: {
      title: 'API文档',
      version: '1.0.0',
      description: 'API文档描述'
    },
    servers: [
      {
        url: 'http://localhost:4000'
      }
    ],
    components: {
      securitySchemes: {
        bearerAuth: {
          type: 'apiKey',
          in: 'header',
          name: 'book-token',
          description: '请输入token'
        }
      }
    },
    security: [{
      bearerAuth: [] as string[]
    }]
  },
  apis: [path.join(__dirname, '../routes', '*.js')]
};

export const swaggerDocs = swaggerJsDoc(swaggerOptions);
